import request from '@/config/axios'

// 内容评论 VO
export interface CommentVO {
  id: number // ID
  text: string // 评论内容
  createUserIp: string // 评论人IP
  contentId: number // 内容id
  siteId: number // 站点ID
  status: number // 审核状态 0待审核 1通过 2不通过
  replyTime: Date // 回复时间
  replyUserId: number // 回复管理员用户id
  userId: number // 创建人ID
}

// 内容评论 API
export const CommentApi = {
  // 查询内容评论分页
  getCommentPage: async (params: any) => {
    return await request.get({ url: `/cms/comment/page`, params })
  },

  // 查询内容评论详情
  getComment: async (id: number) => {
    return await request.get({ url: `/cms/comment/get?id=` + id })
  },

  // 新增内容评论
  createComment: async (data: CommentVO) => {
    return await request.post({ url: `/cms/comment/create`, data })
  },

  // 修改内容评论
  updateComment: async (data: CommentVO) => {
    return await request.put({ url: `/cms/comment/update`, data })
  },

  // 删除内容评论
  deleteComment: async (id: number) => {
    return await request.delete({ url: `/cms/comment/delete?id=` + id })
  },

  // 通过内容评论
  passComment: async (id: number) => {
    return await request.post({ url: '/cms/comment/pass?id=' + id })
  },

  // 不通过内容评论
  rejectComment: async (id: number) => {
    return await request.post({ url: '/cms/comment/reject?id=' + id })
  },

  // 导出内容评论 Excel
  exportComment: async (params) => {
    return await request.download({ url: `/cms/comment/export-excel`, params })
  },
}
